package com.dreamchaser.familydevice.util;

import java.math.BigDecimal;

/**
 * 便捷通用简单方法
 */
public class Util {
    /**
     * 判断是否为null或空字符串
     *
     * @param value
     * @return
     */
    public static Boolean IsNullOrEmpty(String value) {
        return value == null || value.trim().isEmpty();
    }

    /**
     * 判断是否为null或值大于0
     *
     * @param value
     * @return
     */
    public static Boolean IsNullOrZero(Integer value) {
        return value == null || value == 0;
    }

    public static Boolean IsNullOrZero(BigDecimal value) {
        return value == null || value.compareTo(new BigDecimal(0)) == 0;
    }

    public static Boolean IsNullOrZero(Long value) {
        return value == null || value == 0;
    }

    public static Boolean IsGTZero(Integer value) {
        return value != null && value > 0;
    }


    public static Boolean IsGTZero(BigDecimal value) {
        return value != null && value.compareTo(new BigDecimal(0)) > 0;
    }

    public static Boolean IsGTZero(Long value) {
        return value != null && value > 0;
    }
}
